// VaxSIPUserAgentLib.h: interface for the CVaxSIPUserAgentLib class.
//
//////////////////////////////////////////////////////////////////////

#pragma once

class CVaxUserAgentSIPLibEx;

class CVaxSIPUserAgentLib  
{

public:

	CVaxSIPUserAgentLib();
	~CVaxSIPUserAgentLib();

private:

	CVaxUserAgentSIPLibEx* m_pVaxAgentLibEx;

public:

	LPCTSTR GetCallId(int nLineNo);

	int GetMicSoundLevel();
	int GetSpkSoundLevel();

	int GetAudioInDevTotal();
	int GetAudioOutDevTotal();

	LPCTSTR GetAudioOutDevName(int nDeviceId);
	LPCTSTR GetAudioInDevName(int nDeviceId);

	int GetAudioInDevId(int nDeviceId);
	int GetAudioOutDevId(int nDeviceId);

	BOOL InitializeEx(BOOL bBindToListenIP, LPCTSTR sListenIP, UINT nListenPort, LPCTSTR sUserName, LPCTSTR sLogin, LPCTSTR sLoginPwd, LPCTSTR sDisplayName, LPCTSTR sDomainRealm, LPCTSTR sSIPProxy, LPCTSTR sSIPOutBoundProxy, BOOL bUseSoundDevice, int nTotalLine);
	BOOL Initialize(BOOL bBindToListenIP, LPCTSTR sListenIP, UINT nListenPort, LPCTSTR sFromURI, LPCTSTR sSIPOutBoundProxy, LPCTSTR sSIPProxy, LPCTSTR sLoginId, LPCTSTR sLoginPwd, BOOL bUseSoundDevice, int nTotalLine);

	void UnInitialize();

	BOOL RegisterToProxy(int nExpire);
	BOOL UnRegisterToProxy();
	
	BOOL OpenLine(int nLineNo, BOOL bBindToRTPRxIP, LPCTSTR sRTPRxIP, UINT nRxAudioPortRTP, UINT nRxVideoPortRTP);
	BOOL OpenLine(int nLineNo, BOOL bBindToRTPRxIP, LPCTSTR sRTPRxIP, UINT nRxAudioPortRTP);
	BOOL CloseLine(int nLineNo);

	BOOL SetLicenceKey(LPCTSTR sLicenceKey);
	DWORD GetVaxObjectError();
			
	BOOL DialCall(int nLineNo, LPCTSTR sDialNo, int nInputDeviceId, int nOutputDeviceId);
	BOOL Connect(int nLineNo, LPCTSTR sToURI, int nInputDeviceId, int nOutputDeviceId);
	BOOL ConnectCall(int nLineNo, LPCTSTR sFromURI, LPCTSTR sToURI, int nInputDeviceId, int nOutputDeviceId);

	BOOL Disconnect(int nLineNo);

	BOOL AcceptCall(int nLineNo, LPCTSTR sCallId, int nInputDeviceId, int nOutputDeviceId);
	BOOL RejectCall(LPCTSTR sCallId);
	
	BOOL TransferCallEx(int nLineNo, LPCTSTR sToUserName);
	BOOL TransferCall(int nLineNo, LPCTSTR sToURI);
	BOOL JoinTwoLine(int nLineNoA, int nLineNoB);
	
	BOOL HoldLine(int nLineNo);
	BOOL UnHoldLine(int nLineNo);
	
	BOOL IsLineOpen(int nLineNo);
	BOOL IsLineHold(int nLineNo);
	BOOL IsLineBusy(int nLineNo);
	BOOL IsLineConnected(int nLineNo);
	
	BOOL EnableKeepAlive(int nSeconds);
	void DisableKeepAlive();

	void DeselectAllVoiceCodec();
	void SelectAllVoiceCodec();
	BOOL SelectVoiceCodec(int nCodecNo);
	BOOL DeselectVoiceCodec(int nCodecNo);

	LPCTSTR GetMyIP();
	BOOL GetStartMyIP();
	LPCTSTR GetNextMyIP();
	
	BOOL DigitDTMF(int nLineNo, LPCTSTR sDigit);
	BOOL SetDTMFVolume(int nVolume);
	int GetDTMFVolume();

	BOOL EnableForceInbandDTMF(int nLineNo);
	BOOL DisableForceInbandDTMF(int nLineNo);

	BOOL EnableForceInfoDTMF(int nLineNo);
	BOOL DisableForceInfoDTMF(int nLineNo);
	
	BOOL EnableForceRfc2833DTMF(int nLineNo);
	BOOL DisableForceRfc2833DTMF(int nLineNo);

	BOOL MuteMic(BOOL bMute);
	BOOL MuteSpk(BOOL bMute);
	
	int GetMicVolume();
	BOOL SetMicVolume(int nVolume);
	int GetSpkVolume();
	BOOL SetSpkVolume(int nVolume);

	BOOL EnableMicBoost();
	BOOL DisableMicBoost();
	BOOL IsMicBoostEnable();

	BOOL EnableAGC(int nLevel);
	BOOL DisableAGC();
	
	BOOL EnableEchoNoiseCancellation();
	BOOL DisableEchoNoiseCancellation();

	BOOL IsRecording(int nLineNo);
	BOOL StartRecording(int nLineNo, int nRecordVoice, BOOL bRecordCompress);
	BOOL StopRecording(int nLineNo);
	BOOL ResetRecording(int nLineNo);
	BOOL SaveRecordingToWaveFile(int nLineNo, LPCTSTR sFileName);

	BOOL IsWaveFilePlaying(int nLineNo);
	
	BOOL PlayWaveOpen(int nLineNo, LPCTSTR sFileName);
	BOOL PlayWaveClose(int nLineNo);

	BOOL PlayWaveSkipTo(int nLineNo, int nSeconds);
	int PlayWaveTotalTime(int nLineNo);
	BOOL PlayWavePause(int nLineNo);
	BOOL PlayWaveStart(int nLineNo, BOOL bListen);
	BOOL PlayWaveStop(int nLineNo);
	int PlayWavePosition(int nLineNo);

	void EnableDonotDisturb();
	void DisableDonotDisturb();

	int GetOutboundCodec(int nLineNo);
	int GetInboundCodec(int nLineNo);

	LPCTSTR GetVersionFile();
	LPCTSTR GetVersionSDK();

	void SetSessionLostTick(int nMinute);
	
	BOOL SetSpkSoftVolume(int nVolume);
	
	BOOL SetLineSpkVol(int nLineNo, int nVolume);
	int GetLineSpkVol(int nLineNo);

	BOOL MuteLineSPK(int nLineNo, BOOL bEnable);
	BOOL MuteLineMIC(int nLineNo, BOOL bEnable);

	BOOL SetUserAgentSIP(LPCTSTR sUserAgentName);
	LPCTSTR GetUserAgentSIP();

	BOOL SetSubjectSDP(LPCTSTR sSubjectSDP);
	LPCTSTR GetSubjectSDP();

	BOOL ConfAllowLine(int nLineNo, BOOL bAllowListen, BOOL bAllowSpeak);
	BOOL LineVoiceChannelSPK(int nLineNo, int nChannel);

	BOOL ChatAddContact(LPCTSTR sUserName);
	BOOL ChatRemoveContact(LPCTSTR sUserName);
	
	BOOL ChatSendMessageTyping(LPCTSTR sUserName, int nUserValue32bit);
	BOOL ChatSendMessageText(LPCTSTR sUserName, LPCTSTR sMsgText, int nMsgType, int nUserValue32bit);
	
	BOOL ChatSetMyStatus(int nStatusId);
	
	BOOL VoiceChanger(int nPitch);
	BOOL ForwardCall(BOOL bEnable, LPCTSTR sToUserName);

	BOOL PlayAddPCM(int nLineNo, char* pDataPCM, DWORD dwSizePCM);
	BOOL PlayResetPCM(int nLineNo);
	BOOL CaptureStreamPCM(int nLineNo, BOOL bEnable);

	BOOL DetectAMD(int nLineNo, BOOL bEnable, int nAnalysisTime, int nSilenceTime, int nSilenceCount);

	BOOL AddCustomHeader(int nLineNo, int nReqId, LPCTSTR sName, LPCTSTR sValue);
	BOOL RemoveCustomHeader(int nLineNo, int nReqId, LPCTSTR sName);
	BOOL RemoveCustomHeaderAll(int nLineNo, int nReqId);

	BOOL ActivateQosSIP(int nPriorityQos);
	void DeactivateQosSIP();

	BOOL ActivateQosRTP(int nLineNo, int nPriorityQos);
	void DeactivateQosRTP(int nLineNo);

	int GetCountPacketLost(int nLineNo);
	int GetSizeJitterBuffer(int nLineNo);

	BOOL OpenMediaSecondry(int nInputDeviceId, int nOutputDeviceId);
	BOOL CloseMediaSecondry();

	BOOL ChangeMEDIA(int nLineNo, int nInputDeviceId, int nOutputDeviceId);

	////////////////////////////////////////////////////////////////

	int GetVideoDevTotal();
	LPCTSTR GetVideoDevName(int nDeviceId);

	void DeselectAllVideoCodec();
	void SelectAllVideoCodec(int nQuality);
	BOOL SelectVideoCodec(int nCodecNo, int nQuality);
	BOOL DeselectVideoCodec(int nCodecNo);

	BOOL OpenVideoDev(int nDeviceId, int nQuality);
	void CloseVideoDev();

	////////////////////////////////////////////////////////////////

	BOOL CryptCOMM(BOOL bEnable, LPCTSTR sRemoteIP, int nRemotePort);

	////////////////////////////////////////////////////////////////

	BOOL DialCallToREC(int nLineNo, LPCTSTR sDialNo);
	
	BOOL RegisterToProxyREC(BOOL bRegister, int nExpire, LPCTSTR sUserName, LPCTSTR sLoginId, LPCTSTR sLoginPwd, LPCTSTR sDisplayName, LPCTSTR sDomainRealm, LPCTSTR sProxySIP);
	BOOL UnRegisterToProxyREC();

	BOOL OpenLineREC(int nLineNo, BOOL bBindToRTPRxIP, LPCTSTR sRTPRxIP, UINT nAudioPortRTP);

	///////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////

	virtual void OnFailToTransfer(int nLineNo, int nStatusCode, LPCTSTR sReasonPhrase);

	virtual void OnTryingToRegister();
	virtual void OnFailToRegister();
	virtual void OnFailToRegisterEx(int nStatusCode, LPCTSTR sReasonPhrase);
	virtual void OnSuccessToRegister();

	virtual void OnTryingToReRegister();
	virtual void OnFailToReRegister();
	virtual void OnFailToReRegisterEx(int nStatusCode, LPCTSTR sReasonPhrase);
	virtual void OnSuccessToReRegister();
	
	virtual void OnTryingToUnRegister();
	virtual void OnFailToUnRegister();
	virtual void OnSuccessToUnRegister();
		
	virtual void OnConnecting(int nLineNo);
	virtual void OnSuccessToConnect(int nLineNo, LPCTSTR sToRTPIP, UINT nToRTPPort);
	virtual void OnFailToConnect(int nLineNo);
		
	virtual void OnDisconnectCall(int nLineNo);
	virtual void OnCallTransferAccepted(int nLineNo);
	virtual void OnPlayWaveDone(int nLineNo);
	virtual void OnDTMFDigit(int nLineNo, LPCTSTR sDigit);
	
	virtual void OnMsgNOTIFY(LPCTSTR sMsg);
	virtual void OnVoiceMailMsg(BOOL bIsMsgWaiting, DWORD dwNewMsgCount, DWORD dwOldMsgCount, DWORD dwNewUrgentMsgCount, DWORD dwOldUrgentMsgCount, LPCTSTR sMsgAccount);

	virtual void OnIncomingCall(LPCTSTR sCallId, LPCTSTR sDisplayName, LPCTSTR sUserName, LPCTSTR sFromURI, LPCTSTR sToURI);
	virtual void OnIncomingCallRingingStart(LPCTSTR sCallId);
	virtual void OnIncomingCallRingingStop(LPCTSTR sCallId);
		
	virtual void OnProvisionalResponse(int nLineNo, int nStatusCode, LPCTSTR sReasonPhrase);
	virtual void OnRedirectionResponse(int nLineNo, int nStatusCode, LPCTSTR sReasonPhrase, LPCTSTR sContact);
	virtual void OnRequestFailureResponse(int nLineNo, int nStatusCode, LPCTSTR sReasonPhrase);
	virtual void OnServerFailureResponse(int nLineNo, int nStatusCode, LPCTSTR sReasonPhrase);
	virtual void OnGeneralFailureResponse(int nLineNo, int nStatusCode, LPCTSTR sReasonPhrase);

	virtual void OnIncomingDiagnostic(LPCTSTR sMsgSIP, LPCTSTR sFromIP, UINT nFromPort);
	virtual void OnOutgoingDiagnostic(LPCTSTR sMsgSIP, LPCTSTR sToIP, UINT nToPort);

	virtual void OnSessionLostEvent(int nLineNo);
	
	virtual void OnSuccessToHold(int nLineNo);
	virtual void OnTryingToHold(int nLineNo);
	virtual void OnFailToHold(int nLineNo);

	virtual void OnSuccessToUnHold(int nLineNo);
	virtual void OnTryingToUnHold(int nLineNo);
	virtual void OnFailToUnHold(int nLineNo);

	virtual void OnChatContactStatus(LPCTSTR sUserName, int nStatusId);
	
	virtual void OnChatSendMsgTextSuccess(LPCTSTR sUserName, LPCTSTR sMsgText, int nUserValue32bit);
	virtual void OnChatSendMsgTextFail(LPCTSTR sUserName, int nStatusCode, LPCTSTR sReasonPhrase, LPCTSTR sMsgText, int nUserValue32bit);
	
	virtual void OnChatSendMsgTypingSuccess(LPCTSTR sUserName, int nUserValue32bit);
	virtual void OnChatSendMsgTypingFail(LPCTSTR sUserName, int nStatusCode, LPCTSTR sReasonPhrase, int nUserValue32bit);

	virtual void OnChatRecvMsgText(LPCTSTR sUserName, LPCTSTR sMsgText);
	virtual void OnChatRecvMsgTypingStart(LPCTSTR sUserName);
	virtual void OnChatRecvMsgTypingStop(LPCTSTR sUserName);

	virtual void OnVoiceStreamPCM(int nLineNo, char* pDataPCM, int nSizePCM);
	virtual void OnDetectedAMD(int nLineNo, BOOL bIsHuman);

	virtual void OnHoldCall(int nLineNo);
	virtual void OnUnHoldCall(int nLineNo);

	virtual void OnVideoRemoteShowStart(int nLineNo);
	virtual void OnVideoRemoteShowStop(int nLineNo);
	virtual void OnVideoRemoteShowRGB(int nLineNo, BYTE* pFrameRGB, DWORD dwFrameSize, DWORD dwFrameWidth, DWORD dwFrameHeight);
	virtual void OnVideoDeviceShowRGB(int nDeviceId, BYTE* pFrameRGB, DWORD dwFrameSize, DWORD dwFrameWidth, DWORD dwFrameHeight);
	
	/////////////////////////////////////////////////////////////////////////////////////////

	virtual void OnTryingToRegisterREC();
	virtual void OnFailToRegisterREC(int nStatusCode, LPCTSTR sReasonPhrase);
	virtual void OnSuccessToRegisterREC();

	virtual void OnTryingToReRegisterREC();
	virtual void OnFailToReRegisterREC(int nStatusCode, LPCTSTR sReasonPhrase);
	virtual void OnSuccessToReRegisterREC();
	
	virtual void OnTryingToUnRegisterREC();
	virtual void OnFailToUnRegisterREC();
	virtual void OnSuccessToUnRegisterREC();
		
	virtual void OnServerConnectingREC(int nLineNo, int nStatusCode, LPCTSTR sReasonPhrase);
	virtual void OnServerConnectedREC(int nLineNo);
	virtual void OnServerFailedREC(int nLineNo, int nStatusCode, LPCTSTR sReasonPhrase);
	virtual void OnServerHungupREC(int nLineNo);
};


